package com.yz.house.ui.activity;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.yz.house.R;
import com.yz.house.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Demo
 *
 * @author zhangyf
 * @date 2018/4/13 0013.
 */
public class SettingActivity extends BaseActivity {


    @BindView(R.id.rl_modify)
    RelativeLayout rlModify;
    @BindView(R.id.rl_clear)
    RelativeLayout rlClear;
    @BindView(R.id.rl_about)
    RelativeLayout rlAbout;
    @BindView(R.id.btn_login)
    Button btnLogin;
    @BindView(R.id.tv_cache)
    TextView tv_cache;

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.activity_setting;
    }

    @Override
    protected void initVariables(Bundle extras, Bundle savedInstanceState) {
    }

    @Override
    protected void initViews() {
    }

    @Override
    protected boolean shouldBindEvent() {
        return false;
    }


    @OnClick({R.id.iv_back, R.id.rl_modify, R.id.rl_clear, R.id.rl_about, R.id.btn_login})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                onBackPressed();
                break;
            case R.id.rl_modify:
                Toast.makeText(this,"请先登录",Toast.LENGTH_SHORT);
                break;
            case R.id.rl_clear:
                new AlertDialog.Builder(this).setTitle("确定清除？").setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        tv_cache.setText("");
                    }
                }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                    }
                }).show();
                break;
            case R.id.rl_about:
                readyGo(AboutActivity.class);
                break;
            case R.id.btn_login:
                Toast.makeText(this,"功能正在开发中",Toast.LENGTH_SHORT).show();
                break;
        }
    }
}
